package com.wangxinenpu.springbootdemo.controller;

import com.wangxinenpu.springbootdemo.dataobject.model.SysSystem;
import com.wangxinenpu.springbootdemo.dataobject.vo.process.ProcessDefinitionDetailVO;
import com.wangxinenpu.springbootdemo.dataobject.vo.task.AjaxResult;
import com.wangxinenpu.springbootdemo.service.ISysSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.repository.ProcessDefinition;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author baomidou
 * @since 2024-04-15
 */
@Controller
@RequestMapping("/system/sysSystem")
@Api(tags = "外部系统管理")
@RestController
public class SysSystemController {
    @Resource
    private  RepositoryService repositoryService;
    @Resource
    private  RuntimeService runtimeService;

    @Resource
    ISysSystemService sysSystemService;
    @ApiOperation(value = "外部系统列表",notes = "外部系统列表")
    @GetMapping("list")
    public AjaxResult getList(){
        return AjaxResult.success(sysSystemService.list());
    }


    @ApiOperation(value = "外部系统详情",notes = "外部系统详情")
    @GetMapping("detail")
    public AjaxResult detail(@RequestParam("id")String id){
        return AjaxResult.success(sysSystemService.getById(id));
    }

    @ApiOperation(value = "保存外部系统",notes = "保存外部系统")
    @PostMapping("save")
    public AjaxResult save(@RequestBody SysSystem sysSystem){
        return AjaxResult.success(sysSystemService.saveOrUpdate(sysSystem));
    }

    @ApiOperation(value = "删除外部系统",notes = "删除外部系统")
    @PostMapping("del")
    public AjaxResult del(@RequestParam("id")String id){
        return AjaxResult.success(sysSystemService.removeById(id));
    }



}
